package smarthouse.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;

/**
 * The persistent class for the room database table.
 * 
 */
@Entity
@NamedQuery(name = "Room.findAll", query = "SELECT r FROM Room r")
public class Room implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int roomId;

	private int light;

	private int size;

	private int temperature;

	private String type;

	// bi-directional many-to-one association to Electronic
	@OneToMany(mappedBy = "room")
	private List<Electronic> electronics;

	// bi-directional many-to-one association to House
	@ManyToOne
	@JoinColumn(name = "houseId")
	private House house;

	/**
	 * Default constructor
	 */
	public Room() {
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public int getRoomId() {
		return this.roomId;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public void setRoomId(int roomId) {
		this.roomId = roomId;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public int getLight() {
		return this.light;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public void setLight(int light) {
		this.light = light;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public int getSize() {
		return this.size;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public void setSize(int size) {
		this.size = size;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public int getTemperature() {
		return this.temperature;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public void setTemperature(int temperature) {
		this.temperature = temperature;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public String getType() {
		return this.type;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public List<Electronic> getElectronics() {
		return this.electronics;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public void setElectronics(List<Electronic> electronics) {
		this.electronics = electronics;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public Electronic addElectronic(Electronic electronic) {
		getElectronics().add(electronic);
		electronic.setRoom(this);

		return electronic;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public Electronic removeElectronic(Electronic electronic) {
		getElectronics().remove(electronic);
		electronic.setRoom(null);

		return electronic;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public House getHouse() {
		return this.house;
	}

	/**
	 * Getter/Setter
	 * 
	 * @return
	 */
	public void setHouse(House house) {
		this.house = house;
	}

}